<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="pojo.*,java.util.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
   table{
      border:1px solid blue;
      margin:0 auto;
      width:600px;
     border-collapse: collapse;
   }
   .nav{
   width:300px;
   margin:0 auto;
   }
   .buy{
     margin:0 auto;
      width:600px;
      text-align:center;
   }
   #addressContent{
   width:600px;
   margin:0 auto;
   overflow:hidden;
   }
   .address{
       width:200px;
       float:left;
       border:1px solid blue;
       margin:10px;sss
   }
   
</style>
</head>
<body>
<% Customer cu =(Customer)(session.getAttribute("c"));
   List<Cart> cartlist = (List<Cart>)(request.getAttribute("cartlist"));
List<UserAddress> addresslist = (List<UserAddress>)(request.getAttribute("addresslist"));
 %>
 
 <form action="OrderServlet?method=addorder" method="post">
 <div id="addressContent">
   <h2>选择收货地址</h2>
   <% for(UserAddress address:addresslist){ %>
    <div class="address">
         <input type="radio" name="addressid" value="<%=address.getUid() %>"/>
          <%=address.getName() %><br/>
         <%=address.getTel() %><br/>
         <%=address.getAddress() %>
     </div>
   <%} %><br>
   <a href="addAddress.jsp?name=<%=cu.getC_name()%>">添加地址</a>
 </div>
<table border=1>
  <tr>
   <th>商品名称</th>
   <th>商品图片</th>
    <th>商品数量</th>
    <th>商品单价</th>
    <th>总金额</th>
 </tr>
 <%
    for(Cart p:cartlist){
  %>
<tr>
         <input type="hidden" name="cid" value="<%=p.getC_id() %>"/>
   <td> <%=p.getP_name() %></td>
   <input type="hidden" name="pid" value="<%=p.getP_id()%>"/>
   <td>  <img src="<%=p.getP_image() %>" width="50px" height="50px"/></td>
      <td><%=p.getQuantity()%><input type="hidden" name="pquantity" value="<%=p.getQuantity()%>"/></td>
      <td><%=p.getP_price()%>
      <input type="hidden" name="pprice" value="<%=p.getP_price()%>"/>
      </td>
      <td> <input type="hidden" name="pamount" value="<%=p.getAmount()%>"/>
      <%=p.getAmount()%></td>
 </tr>
 <%} %>
</table>
<div class="buy"><button>提交订单</button></div>
</form>
  <div class="nav">

 </div>
</body>
</html>